package WebTopN6;

import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class WebTopNReducer extends Reducer<WebBean, FloatWritable, WebBean,FloatWritable> {
    @Override
    protected void reduce(WebBean key, Iterable<FloatWritable> values, Reducer<WebBean, FloatWritable, WebBean, FloatWritable>.Context context) throws IOException, InterruptedException {
        int num = 0;
        for (FloatWritable value : values){
            if (num < 10){
                context.write(key,value);
                num++;
            } else {
                return;
            }
        }
    }
}
